#ifndef OPENGLWRAPPER_GLWindow_H_
#define OPENGLWRAPPER_GLWindow_H_

#include "GLRenderingContext.h"
#include "GLApplication.h"

namespace OpenGLWrapper
{
	//
	// Class that represent OpenGL-Enabled window
	//
	class GLWindow
	{
	private:

		//
		// The application instance 
		//
		HINSTANCE _hInstance;

		//
		// The Window Handle
		//
		HWND _hWnd;

		//
		// The Device Context Handle
		//
		HDC _hDC;

		//
		// The window rectangle
		//
		RECT _windowRect;

		//
		// If the window is fullscreen or not
		//
		BOOL _isFullScreen;

		//
		// The color depth
		//
		int _colorDepth;

		//
		// Is the window running
		//
		BOOL _isRunning;

		//
		// Rendering Context
		//
		GLRenderingContext* _renderingContext;

		//
		// The game application attached to the window
		//
		GLApplication* _glAppplication;

	public:

		//
		// Default constructor
		//
		GLWindow();

		//
		// Create a default window on the application
		//
		GLWindow(HINSTANCE hInstance);

		//
		// Create window with attached settings
		//
		GLWindow(HINSTANCE hInstance, int windowWidth, int windowHeight, int colorDepth, BOOL isFullScreen);

		// 
		// Window Destructor
		~GLWindow();

	public:

		// 
		// Create the window
		//
		GLError Create(HINSTANCE hInstance, int windowWidth, int windowHeight, int colorDepth, BOOL isFullScreen);

		//
		// Destroy the window
		//
		GLError Destroy();

		//
		// Check if the window is still running
		//
		BOOL IsRunning();

		//
		// Process window messaged
		//
		GLError ProcessEvents();

		//
		// Swap Window Buffers
		//
		GLError SwapBuffers();

		//
		// Set the glApplication attached to the window
		//
		void SetGLApplication(GLApplication* glApplication);

	private:

		//
		// The Object window handler
		//
		LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

		//
		// The Static Window Handler
		//
		static LRESULT CALLBACK StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
	};
}

#endif
